package com.person.controller;

import com.person.common.CommonResult;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/consumer80")
public class MyPaymentController {
    public static final String INVOKE_URL = "http://cloudproviderpayment8004";
    @Resource
    private RestTemplate restTemplate;
    @Resource
    private DiscoveryClient discoveryClient;

    @GetMapping("/find/{id}")
    public CommonResult get(@PathVariable("id") String id) {
        List<String> services = discoveryClient.getServices();
        //这里是master
        //所得税广东省
        int age = 10 / 2;
        return restTemplate.getForObject(INVOKE_URL + "/zookeeper8004/find/" + id, CommonResult.class);
    }
}
